# -*- coding: utf-8 -*-
# author: AZJ
# date: 2024/11/7
# 假如命运扼住了你的咽喉，你就去挠她的咯吱窝
from email.mime.text import MIMEText
from email.header import Header
# import email
# QQ邮箱授权码: oqheghovhsfsbbcg
# efrfirrpwgwibfee
import smtplib
from_addr = "595337088@qq.com"
password = "efrfirrpwgwibfee"
to_addr = "woxuanzeai@hotmail.com"
stmp_server = 'smtp.qq.com'
# msg = MIMEText("使用python发邮箱测试", "plain", "utf-8")
# msg['From'] = Header(from_addr)
# msg['To'] = Header(to_addr)
# subject = "使用python发邮箱测试"
# msg['Subject'] = Header(subject, 'utf-8')
html_msg = """
<p>Python 邮件发送HTML格式⽂件测试...</p>
<p><a href="http://www.runoob.com">这是⼀个链接</a></p>
"""
msg = MIMEText(html_msg, 'html', 'utf-8')
msg['From'] = Header('299@qq.com')
msg['To'] = Header('207@qq.com')
subject = 'Python SMTP 邮件测试'
msg['Subject'] = Header(subject, 'utf-8')
# print(msg)
try:
    with smtplib.SMTP_SSL(stmp_server, 465) as smtp:
        smtp.login(from_addr, password)
        smtp.sendmail(from_addr, to_addr, msg.as_string())
    print("邮件发送成功")
except Exception as e:
    print("发生错误:\n", e)